<template>
  <div class="EnterpriseAudit">
    <div class="tittle">首页-待审核</div>
    <div class="Ltop">
      <!-- <span style="color:#3377FF;background-color:#E6E9F0">待审核人才{{}}个</span>
      <span style="color:#3377FF;background-color:#E6E9F0">待审核企业{{}}个</span>-->

      <span
        v-if="data.talentPage != null"
        :class="{active:0 == activeIndex}"
        @click="doClick(0)"
        style="cursor:pointer">待审核人才{{data.talentTotal}}个</span>
      <span
        v-if="data.companyPage != null"
        :class="{active:1 == activeIndex}"
        @click="doClick(1)"
        style="cursor:pointer"
      >待审核企业{{data.companyTotal}}个</span>
    </div>
    <div class="Lcontent">
      <div class="Ltabel">
        <el-table
          v-show="activeIndex == 0"
          :header-cell-style="{background:'rgba(247,249,252,1)',color:'#1F2E4D',}"
          :row-class-name:hover="{background:'red'}"
          border
          :data="talentTableData"
          style="width: 100%">
          <el-table-column align="center" prop="platfromName" label="审核专员姓名"></el-table-column>
          <el-table-column align="center" label="待审核人才数量">
            <template slot-scope="scope">
              <div>
                待审核人才
                <span
                  style="color:#3377FF"
                  @click="lookinfo(scope.row.id)">{{scope.row.talentNums}}</span> 个
              </div>
            </template>
          </el-table-column>
          <!-- <el-table-column align="center" prop="fullName" label="审核专员姓名"></el-table-column>
          <el-table-column align="center" prop="nums" label="待审核数量">
               <template slot-scope="scope">
              <div > 待审核 <span style="color:#3377FF">{{scope.row.nums}}</span> 个</div>
            </template>
          </el-table-column>-->
        </el-table>
        <el-table
          v-show="activeIndex == 1"
          :header-cell-style="{background:'rgba(247,249,252,1)',color:'#1F2E4D',}"
          :row-class-name:hover="{background:'red'}"
          border
          :data="companyTableData"
          style="width: 100%">
          <el-table-column align="center" prop="platfromName" label="顾问姓名"></el-table-column>
          <el-table-column align="center" label="待审核企业数量">
            <template slot-scope="scope">
              <div>
                待审核企业
                <span
                  style="color:#3377FF"
                  @click="lookinfo(scope.row.id)"
                >{{scope.row.companyNums}}</span> 个
              </div>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="fen">
        <el-pagination
          style="text-align: right;margin-right: 40px"
          background
          @current-change="pageChange"
          :current-page.sync="currPageNo"
          :page-size="pageSize"
          layout="total,prev, pager, next"
          :total="activeIndex == 0 ? talentTotal : companyTotal"
        ></el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'EnterpriseAudit',
  data() {
    return {
      activeIndex: 0,
      btnlist: [
        { name: '待审核人才', isActive: true },
        { name: '待审核企业', isActive: false }
      ],
      talentTableData: [],
      companyTableData: [],
      msg: '审核', //审核通过  msg=修改
      data: {},
      currPageNo: 1,
      pageSize: 10,
      talentTotal: 0,
      companyTotal: 0,
      type: 0,
      time: [],
      startTimeStr: '',
      endTimeStr: ''
    }
  },
  methods: {
    pageChange(val) {
      console.log('分页' + val)
      this.currPageNo = val
      this.initData()
    },
    initQuery() {
      if (this.$route.query.time != []) {
        this.time = this.$route.query.time
        this.startTimeStr = this.time[0]
        this.endTimeStr = this.time[1]
      }
      this.activeIndex = this.$route.query.index;
      this.type =this.$route.query.type;
    },
    doClick(index) {
      console.log(index)
      this.activeIndex = index;
    },
    initData() {
      this.lAxios({
        method: 'post',
        url: '/platform/selectAutdioTalentAndCompany.do',
        params: {
          //传参
          currPageNo: this.currPageNo,
          pageSize: this.pageSize,
          orderBy: '',
          startTimeStr: this.startTimeStr,
          endTimeStr: this.endTimeStr,
          type: this.type
        }
      })
        .then(res => {
          console.log(res)
          if (res.data.status == 0) {
            this.data = res.data.data ? res.data.data : {}
            if (res.data.data == {}) {
              this.talentTableData = []
              this.companyTableData = []
            } else {
              if (this.data.talentPage == null) {
                // this.activeIndex = 1
              } else {
                this.talentTotal = res.data.data.talentPage.total
                  ? res.data.data.talentPage.total
                  : 0
                this.talentTableData = res.data.data.talentPage.list
                  ? res.data.data.talentPage.list : []
              }
              if (this.data.companyPage == null) {
                // this.activeIndex = 0
              } else {
                this.companyTotal = res.data.data.companyPage.total
                  ? res.data.data.companyPage.total : 0
                this.companyTableData = res.data.data.companyPage.list
                  ? res.data.data.companyPage.list : []
              }
              console.log(this.companyTableData)
            }
          }
        }).catch(err => {
          //失败的回调函数
          console.log(err)
        })
    }
  },
  activated() {
    this.initQuery()
    this.initData()
  }
}
</script>

<style scoped>
.EnterpriseAudit {
  width: 100%;
  height: 100vh;
  background-color: #f7f9fc;
  padding-left: 20px;
  /*height: 600px;*/
}

.tittle {
  height: 54px;
  line-height: 54px;
  color: #3d4966;
  font-size: 14px;
}
.Ltop {
  padding: 40px 0 20px 40px;
  background-color: #fff;
}
.Ltop > span {
  border-radius: 5px;
  border: 1px solid rgba(211, 219, 235, 1);
  /* background-color: #fff; */
  height: 50px;
  line-height: 50px;
  text-align: center;
  font-size: 14px;
  margin-right: 25px;
  display: inline-block;
}
.Ltop > span:nth-child(1) {
  width: 125px;
  height: 50px;
}
.Ltop > span:nth-child(2) {
  width: 125px;
  height: 50px;
}
.Ltop > span:nth-child(3) {
  width: 125px;
  height: 50px;
  margin-right: 20px;
}
.Ltop > span:nth-child(4) {
  width: 125px;
  height: 50px;
  margin-right: 20px;
}

.active {
  background-color: #3377ff;
  color: #fff;
}

.Lcontent {
  background-color: #fff;
  padding: 0 50px 40px 40px;
  /*height:276px ;*/
  /*background-color: #f2f2f2;*/
  /* border: 1px solid #797979; */
}
/*-------------------tabel-------------------------*/
.Ltabel {
  margin-bottom: 40px;
}
.fen {
  overflow: hidden;
}
.el-pagination {
  float: right;
}
.btn {
  color: #3377ff;
  border: 1px solid #3377ff;
  border-radius: 5px;
  margin: 0px 60px !important;
}
</style>
